home *** CD-ROM | disk | FTP | other *** search
/ Clickx 115 / Clickx 115.iso / software / tools / windows / tails-i386-0.16.iso / live / filesystem.squashfs / usr / share / laptop-mode-tools / modules / intel-hda-powersave < prev    next >
Encoding:
Text File  |  2012-05-20  |  2.2 KB  |  56 lines

  1. #! /bin/sh
  2. # Laptop mode tools module: Intel HDA integrated audio power saving mode.
  3. #
  4.  
  5. if [ x$CONTROL_INTEL_HDA_POWER = x1 ]  || [ x$ENABLE_AUTO_MODULES = x1 -a x$CONTROL_INTEL_HDA_POWER = xauto ]; then
  6.     if [ $ON_AC -eq 1 ]; then
  7.         if [ "$ACTIVATE" -eq 1 ]; then
  8.             INTEL_HDA_POWERSAVE="$LM_AC_INTEL_HDA_POWERSAVE"
  9.         else
  10.             INTEL_HDA_POWERSAVE="$NOLM_AC_INTEL_HDA_POWERSAVE"
  11.         fi
  12.     else
  13.         INTEL_HDA_POWERSAVE="$BATT_INTEL_HDA_POWERSAVE"
  14.     fi
  15.  
  16.     # Handle Intel HDA Power Save
  17.     if [ -w /sys/module/snd_hda_intel/parameters/power_save ]; then
  18.         if [ x$INTEL_HDA_POWERSAVE = x1 ]; then
  19.                 echo $INTEL_HDA_DEVICE_TIMEOUT > /sys/module/snd_hda_intel/parameters/power_save
  20.                 log "VERBOSE" "Intel HDA power save mode enabled with timeout $INTEL_HDA_DEVICE_TIMEOUT."
  21.                 if [ -c /dev/dsp ]; then
  22.                     # This can fail if the audio device is busy.
  23.                     # Since this failure is non-fatal (worst case is that the timer changes
  24.                     # don't get activated), we don't bother if it was successful or not
  25.                     #(exec 2>/dev/null; echo 1 > /dev/dsp;)
  26.                     # Better way
  27.                     echo 1 2>/dev/null >/dev/dsp
  28.                     log "VERBOSE" "Initialize timer change by close/open /dev/dsp"
  29.                 fi
  30.         else
  31.                 echo 0 > /sys/module/snd_hda_intel/parameters/power_save
  32.                 log "VERBOSE" "Intel HDA power save mode disabled."
  33.         fi
  34.     else
  35.             log "VERBOSE" "Intel HDA power saving is not available on this system."
  36.     fi
  37.  
  38.     # Handle Intel HDA Controller Power Savings.
  39.     if [ x$INTEL_HDA_DEVICE_CONTROLLER = x1 -a x$INTEL_HDA_POWERSAVE = x1 ]; then
  40.         POWER_SAVE="Y"
  41.     else
  42.         POWER_SAVE="N"
  43.     fi
  44.  
  45.     if [ -w /sys/module/snd_hda_intel/parameters/power_save_controller ]; then
  46.         echo $POWER_SAVE > /sys/module/snd_hda_intel/parameters/power_save_controller
  47.         log "VERBOSE" "Intel HDA Controller power save set to $POWER_SAVE."
  48.     else
  49.         log "VERBOSE" "Sound Card doesn't seem to support Controller Power Save."
  50.     fi
  51. else
  52.     log "VERBOSE" "Intel HDA audio power setting is disabled."
  53. fi
  54.  
  55.